'------------------------------
' Hien thi 5 tin moi nhat
'------------------------------
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Namespace NVPortal.Modules.NVVideos

    Public MustInherit Class SettingCustomeDisplaySpecial
        Inherits DotNetNuke.Entities.Modules.ModuleSettingsBase


#Region "Event Handlers"
        Public Overrides Sub LoadSettings()
            Try
                BindPortal()
                If (Page.IsPostBack = False) Then
                    If CType(ModuleSettings("PortalSetting"), String) <> "" Then
                        Me.ddlPortal.Items.FindByValue(ModuleSettings("PortalSetting")).Selected = True
                    End If
                    If CType(ModuleSettings("NVNewsDisplayStyleSetting"), String) <> "" Then
                        Me.ddlDisplayStyle.Items.FindByValue(ModuleSettings("NVNewsDisplayStyleSetting")).Selected = True
                    End If
                End If

            Catch exc As Exception    'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub

        ''' -----------------------------------------------------------------------------
        ''' <summary>
        ''' UpdateSettings saves the modified settings to the Database
        ''' </summary>
        ''' <remarks>
        ''' </remarks>
        ''' <history>
        '''		[cnurse]	10/22/2004	created
        ''' </history>
        ''' -----------------------------------------------------------------------------
        Public Overrides Sub UpdateSettings()
            Try
                Dim objModules As New DotNetNuke.Entities.Modules.ModuleController
                objModules.UpdateModuleSetting(ModuleId, "PortalSetting", Me.ddlPortal.SelectedValue)
                objModules.UpdateModuleSetting(ModuleId, "NVNewsDisplayStyleSetting", Me.ddlDisplayStyle.SelectedValue)
            Catch exc As Exception    'Module failed to load
                ProcessModuleLoadException(Me, exc)
            End Try
        End Sub
        Private Sub BindPortal()
            Dim ctlNewsCategories As New PortalController
            Dim arrNewsCategories As New ArrayList

            Dim strConnString As String = ConfigurationManager.ConnectionStrings("SiteSqlServer").ConnectionString
            Dim con As New SqlConnection(strConnString)
            Dim sda As New SqlDataAdapter()
            Dim cmd As New SqlCommand("select PortalId, PortalName from PortalLocalization")
            cmd.Connection = con
            con.Open()
            Me.ddlPortal.DataSource = cmd.ExecuteReader()
            Me.ddlPortal.DataTextField = "PortalName"
            Me.ddlPortal.DataValueField = "PortalId"
            Me.ddlPortal.DataBind()

        End Sub
#End Region


    End Class

End Namespace
